﻿using netcore_comm.SqlSugar;
using netcore_service.IRepository;
using netcore_service.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace netcore_service.Repositories
{
    public class ManagerRepository : SqlSugarRepository<Users, netData>, IManagerRepository
    {
        private readonly ISqlSugarFactory _sqlSugarFactory;
        public ManagerRepository(ISqlSugarFactory sqlSugarFactory) : base(sqlSugarFactory)
        {
            _sqlSugarFactory = sqlSugarFactory;
        }

        public async Task<List<string>> GetSchoolUserList(string? name, string type)
        {
            var db = _sqlSugarFactory.GetInstance(nameof(netData));
            return await db.Queryable<SchoolRole>().Where(it => it.type == type && it.UserId.Contains(name)).Select(it => it.schoolName).ToListAsync();
        }
    }
}
